home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1995 February / 1995-02b.d64 / money queries (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  2KB  |  56 lines

  1. 95 poke53281,15:poke53280,15
  2. 100 print"[147][144]financial calculations: select one
  3. 110 [153]"1-future value
  4. 120 print"2-present value
  5. 130 [153]"3-loan payments
  6. 140 print"4-loan timing
  7. 150 [153]"5-quit
  8. 160 poke198,0:wait198,7:getx$:x=val(x$):ifx<1orx>5then100
  9. 170 ifx=5thenend
  10. 180 onxgosub290,190,390,510:goto100
  11. 190 print"present value":print"*************
  12. 200 [153]"the amount you need now to get a certain";
  13. 210 [153]"amount at a future date.":f[178]0:t[178]0:r[178]0
  14. 220 [153]"enter the following or zero to end"
  15. 230 [153]"future amount";:x[178]f:[141]620:f[178]x:[139] x[178]0 [167] [142]
  16. 240 [153]"no.periods interest compounded";:x[178]t:[141]620:t[178]x
  17. 250 [153]"% rate per period";:x[178]i:[141]620:i[178]x
  18. 260 r[178]i[173]100:z[178]f[173]((1[170]r)[174]t)
  19. 270 [153]"present value is"z:[137]220
  20. 280 [172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172][172]
  21. 290 [153]"future value":[153]"************
  22. 300 print"the amount you will have if you invest"
  23. 310 print"a certain amount now at a given rate":a=0:t=0:r=0
  24. 320 print"enter the following or zero to end"
  25. 330 print"investment";:x=a:gosub620:a=x:if x=0 then return
  26. 340 print"# periods interest compounded";:x=t:gosub620:t=x
  27. 350 print"% rate per period";:x=i:gosub620:i=x:r=i/100
  28. 360 x=a*(1+r)^t
  29. 370 print"the future value will be"x:goto320
  30. 380 **********************************
  31. 390 print"loan payments":print"*************
  32. 400 [153]"the time you'll need to pay off a loan
  33. 410 print"with a given payment":a=0:p=0:r=0
  34. 420 print"enter the following or zero to end"
  35. 430 print"loan amount";:x=a:gosub620:a=x:if x=0 then return
  36. 440 print"amount of each payment";:x=p:gosub620:p=x
  37. 450 print"% rate per payment";:x=i:gosub620:i=x:r=x/100
  38. 460 x=log(p/(p-a*r))/log(1+r):z=int(x)
  39. 470 print"to pay off this loan, you'll need"z:print"payments of"p"each";
  40. 480 ifint(x+.999)<>zthenprint",and one payment":print"of"p*(x-z);
  41. 490 print:goto420
  42. 500 **********************************
  43. 510 print"loan length":print"***********
  44. 520 [153]"the payments you'll need to complete a
  45. 530 print"loan by a certain time":a=0:p=0:r=0
  46. 540 print"enter the following or zero to end"
  47. 550 print"loan amount";:x=a:gosub620:a=x:if x=0 then return
  48. 560 print"# periods to pay off in";:x=p:gosub620:p=x
  49. 570 print"% rate per payment period";:x=i:gosub620:i=x:r=x/100
  50. 580 x=a*r/(1-1/(1+r)^int(p))
  51. 590 print"to pay off this loan in"int(p)"payments"
  52. 600 print"you'll need each payment to be"x:goto540
  53. 610 **********************************
  54. 620 rem input item
  55. 630 x$=str$(x):print" "x$left$("[157][157][157][157][157][157][157][157][157]",len(x$)+1);:inputx:return
  56.